package com.meiyue.controller;

import com.meiyue.bean.entity.TestCitiesEntity;
import com.meiyue.bean.protocol.NetResult;
import com.meiyue.controller.interfaces.ICityController;
import com.meiyue.library.custom.controller.BaseKvController;
import com.meiyue.library.utils.ResultUtils;
import com.meiyue.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * MeiyueJavaProject
 * com.meiyue.controller
 * Created by Chris Chen
 * 2017/9/15
 * Explain:
 */
@RestController
@RequestMapping("/city")
public class CityController extends BaseKvController<TestCitiesEntity, Integer, CityService>
        implements ICityController {
    @Autowired
    CityService cityService;

    @Override
    public CityService getService() {
        return cityService;
    }

    @Override
    public NetResult<Boolean> addCity(String city) {
        return ResultUtils.buildResult(cityService.addOne(new TestCitiesEntity(city)));
    }
}
